package com.It;

import java.util.Scanner;

public class UserLogin {
    public static void main(String[] args) {
        String username = "张三";
        String password = "123456";
        for(int i = 0;i < 3;i++){
            Scanner sc = new Scanner(System.in);

            System.out.println("请输入您的用户名：");
            String une = sc.nextLine();
            System.out.println("请输入您的密码：");
            String pwd = sc.nextLine();

            if(une.equals(username)&&pwd.equals(password)){
                System.out.println("恭喜您登录成功！");
                break;
            }else{
                if(2-i==0){
                    System.out.println("您的账户被锁定，请与管理员联系");
                }else{
                    System.out.println("您还有"+(2-i)+"次机会");
                }
            }
        }

    }
}
